import java.util.Scanner;

public class FactorialsSum {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int sum = 0;

        for (int i = 0; i < n; i++) {
            sum += factorial(i + 1);
        }

        System.out.println(sum);
    }

    public static int factorial(int a) {
        int number = 1;

        while (a != 0) {
            number *= a;
            a--;
        }

        return number;
    }
}
